package com.msstudio.game.basic;

import java.util.Collection;
import org.webbitserver.WebSocketConnection;
import com.msstudio.message.Msg;


/**
 * The core interface for any active entity in the system. These typically
 * will be {@code UserPlayer}s or {@code MOBPlayer}s, though any kind of
 * {@code Player} can be defined. All implementations must also implement
 * {@code Serializable} and override {@code equals} and {@code hashCode}.
 */
public interface Player extends Entity {
	public final static String CONNECTION_USERNAME = "connectionUserName";
	
    /** The unique name of this {@code Player} */
    String getName();
    
    void setName(String username);
    
    String getPassword();
    
    void setPassword(String password);

    int getId();

    /**
     * TODO: Should this return a boolean or throw an exception for the cases
     * where a message can't be sent? (e.g., a disconnected UserPlayer)
     * Should this include the sender?
     */
    void send(Msg msg);


    /** TODO: Does this make sense? better way to opt-out of messages? */
    boolean wantsToHearMessages();

    /** TODO: is this really a generic aspect of all {@code Player}s? */
    Collection<? extends Item> getItems();
    
    void addItems(Collection<? extends Item>items);

    // generic statistics blob?
    // generic status/state/news/etc.?
    

    /**
     * Handles some game-related event that comes from the server-side logic
     * and not a {@code Player}. The game needs to decide how to respond to
     * this event.
     *
     * @param event the {@code Event}
     *
     * @return the game's reaction to this event
     */
    //ventResponse handleEvent(Event event);
    
    public WebSocketConnection getConnection();
    
    public void setConnection(WebSocketConnection connection);

}
